﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sprout.Core
{
    public class LazyInit
    {
        /// <summary>
        /// 懒加载
        /// </summary>
        /// <typeparam name="TIService"></typeparam>
        /// <returns></returns>
        public static Lazy<TIService> GetLazy<TIService>() where TIService : class
        {
            Lazy<TIService> lazyService = new Lazy<TIService>(() => ServiceLocator.GetService<TIService>());
            return lazyService;
        }
    }
}
